package com.mall.vo;

import com.mall.bean.User;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.util.Date;

/**
 * @author little_super
 * @project hk_mall_background
 * @package com.mall.vo
 * @create 2017-09-02 23:55
 */
public class UserVo {

    private String id;//ID

    private String username;//用户名

    private String sex;//性别

    private String phone;//手机号

    private String email;//邮箱

    private String created;//创建时间

    private String updated;//更新时间

    public UserVo() {
    }

    public UserVo(User user) {
        this.username = user.getUsername();
        this.sex = user.getSex();
        this.phone = user.getPhone();
        this.email = user.getEmail();
        if(user.getCreated() != null){
            this.created =  DateFormatUtils.format(user.getCreated(),"yyyy-MM-dd hh:mm:ss");
        }
        if(user.getUpdated() != null){
            this.updated =  DateFormatUtils.format(user.getUpdated(),"yyyy-MM-dd hh:mm:ss");
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCreated() {
        return created;
    }

    public void setCreated(String created) {
        this.created = created;
    }

    public String getUpdated() {
        return updated;
    }

    public void setUpdated(String updated) {
        this.updated = updated;
    }
}
